/* ==================================================================   
 * Created [2009-4-27 下午11:32:55] by Jon.King 
 * ==================================================================  
 * TSS 
 * ================================================================== 
 * mailTo:jinpujun@hotmail.com
 * Copyright (c) Jon.King, 2009-2012 
 * ================================================================== 
*/

package com.jinhe.tss.cms.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;

/** 
 * 相关文章复合主键.
 * 
 * TODO 需要改进，相关文章的关系是对等的， A1A2 和 A2A1 是一样的。
 * 查询一篇文章的相关文章，既要查询其主动管理别人的，也要查询被动被别人管理的的文章。
 * 或者在每次维护相关文章的时候，都新增两条关联记录
 */
@Embeddable
public class ArticleLationId implements Serializable {

	private static final long serialVersionUID = 3060544573182642746L;
	
	private Long articleId;			//文章编号 PK
    private Long lationArticleId;   //相关文章编号 PK
 
    public Long getLationArticleId() {
        return lationArticleId;
    }
 
    public void setLationArticleId(Long lationArticleId) {
        this.lationArticleId = lationArticleId;
    }
 
    public Long getArticleId() {
        return articleId;
    }
 
    public void setArticleId(Long articleId) {
        this.articleId = articleId;
    }

    public boolean equals(Object obj) {
        ArticleLationId object = (ArticleLationId)obj;
        return this.articleId.equals(object.getArticleId())
        	&& this.lationArticleId.equals(object.getLationArticleId());     
    }   

    public int hashCode() {
        return (this.articleId + "_" + this.lationArticleId).hashCode();
    } 

    public String toString() {
        StringBuffer sb = new StringBuffer();
		sb.append("id=").append(this.articleId).append(",articleId=").append(this.lationArticleId);
		return sb.toString();
    }
}